package com.itcast.LocalDate;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.chrono.IsoChronology;

/*
要写注释哦!!!
*/
public class Test1 {
    public static void main(String[] args) {
        // 0、获取本地日期对象(不可变对象)
        LocalDate localDate = LocalDate.now();
        System.out.println(localDate);
        // 1、获取日期对象中的信息
        int year = localDate.getYear();
        System.out.println(year);
        int monthValue = localDate.getMonthValue();
        System.out.println(monthValue);
        Month month = localDate.getMonth();
        System.out.println(month);
        int dayOfMonth = localDate.getDayOfMonth();
        System.out.println(dayOfMonth);
        int dayOfYear = localDate.getDayOfYear();
        System.out.println(dayOfYear);
        DayOfWeek dayOfWeek = localDate.getDayOfWeek();
        System.out.println(dayOfWeek);
        IsoChronology chronology = localDate.getChronology();
        System.out.println(chronology);

        // 2、直接修改某个信息: withYear、withMonth、withDayOfMonth、withDayOfYear
        LocalDate localDate1 = localDate.withYear(9999);
        System.out.println(localDate1);
        LocalDate localDate2 = localDate.withDayOfMonth(12);
        System.out.println(localDate2);
        LocalDate localDate3 = LocalDate.of(2099, 1, 23);
        LocalDate localDate4 = LocalDate.of(2099, 1, 23);
        System.out.println(localDate4);
        System.out.println(localDate3.equals(localDate4));
        System.out.println(localDate3.isAfter(localDate1));
        System.out.println(localDate3.isBefore(localDate2));

    }
}
